<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:ez="http://java.sun.com/jsf/composite/ezcomp">


    <ui:define name="content">


        <h:panelGroup rendered="true" >
            <h:form>
                <p:panel id="reportPrint" styleClass="noBorder summeryBorder" header="Casheir Session Report Detail">

                    <f:facet name="header" >
                        <h:outputLabel value="#{commonReport.webUser.institution.name}"/> <br/>
                        <h:outputLabel value="Cashier Summary Report - Lab Bills -&nbsp;&nbsp; #{commonReport.webUser.webUserPerson.name}"/>

                        <p:panelGrid columns="4" styleClass="printBlock">
                            <h:outputLabel value="From" />
                            <h:outputLabel  value="#{commonReport.fromDate}" >
                                <f:convertDateTime pattern="dd MM yy hh:mm a"/>
                            </h:outputLabel>
                            <h:outputLabel value="To"/>
                            <h:outputLabel  value="#{commonReport.toDate}" style="float: right" >
                                <f:convertDateTime pattern="dd MM yy hh:mm a"/>
                            </h:outputLabel>
                        </p:panelGrid>

                        <p:commandButton ajax="false" value="Refresh" styleClass="noPrintButton" style="float: right;" actionListener="#{commonReport.recreteModal()}" />  
                        <p:commandButton ajax="false" value="Print" styleClass="noPrintButton" style="float: right;" >
                            <p:printer target="reportPrint" />
                        </p:commandButton>  
                    </f:facet>


                    <p:panelGrid columns="6" style="min-width: 100%;" styleClass="noPrintButton">
                        <h:outputLabel styleClass="noPrintButton"  value="From"/>
                        <p:calendar id="frmDate" value="#{commonReport.fromDate}" navigator="true"  pattern="dd MMMM yyyy HH:mm:ss" >
                        </p:calendar>

                        <h:outputLabel value="To"/>
                        <p:calendar id="toDate" value="#{commonReport.toDate}" navigator="true" pattern="dd MMMM yyyy HH:mm:ss" >
                        </p:calendar>
                        <h:outputLabel styleClass="noPrintButton" value="User Name"/>

                        <p:autoComplete  styleClass="noPrintButton" id="acNewPtArea" converter="webUs" completeMethod="#{webUserController.completeUser}"  var="pta"   itemLabel="#{pta.webUserPerson.name}" itemValue="#{pta}" forceSelection="true" value="#{commonReport.webUser}" >
                            <p:column >
                                <h:outputLabel value="#{pta.code}"/>
                            </p:column>
                            <p:column >
                                <h:outputLabel value="#{pta.webUserPerson.name}"/>
                            </p:column>
                        </p:autoComplete>


                    </p:panelGrid>
                    <br/>



                    <p:dataTable rowStyleClass="noDisplayRow" id="report" value="#{commonReport.userBills.bills}" var="bb"  sortBy="#{bb.billType}" style=" text-align: right;" >

                        <p:column headerText="Lab Bill" style=" " >
                            <h:outputLabel value="Total:"/>
                        </p:column>
                        <p:column headerText="Cash" style="text-align: right; ">
                            <h:outputLabel value="#{commonReport.userBills.cash}">
                                <f:convertNumber pattern="#,##0.00" />
                            </h:outputLabel>
                        </p:column>
                        <p:column headerText="Credit" style="text-align: right; " >
                            <h:outputLabel value="#{commonReport.userBills.credit}">
                                <f:convertNumber pattern="#,##0.00" />
                            </h:outputLabel>

                        </p:column>
                        <p:column  headerText="C Card" style="text-align: right; ">
                            <h:outputLabel value="#{commonReport.userBills.card}">
                                <f:convertNumber pattern="#,##0.00" />
                            </h:outputLabel>
                        </p:column> 
                        <p:column  headerText="Cheque" style="text-align: right; ">
                            <h:outputLabel value="#{commonReport.userBills.cheque}">
                                <f:convertNumber pattern="#,##0.00" />
                            </h:outputLabel>
                        </p:column> 
                        <p:column  headerText="Slip" style="text-align: right; ">
                            <h:outputLabel value="#{commonReport.userBills.slip}">
                                <f:convertNumber pattern="#,##0.00" />
                            </h:outputLabel>
                        </p:column> 

                        <p:summaryRow  >
                            <p:column headerText="" >
                                <h:outputLabel value="Total:"/>
                            </p:column>
                            <p:column headerText="Cash" style="text-align: right; ">
                                <h:outputLabel value="#{commonReport.userBills.cash}">
                                    <f:convertNumber pattern="#,##0.00" />
                                </h:outputLabel>
                            </p:column>
                            <p:column headerText="Credit" style="text-align: right; ">
                                <h:outputLabel value="#{commonReport.userBills.credit}">
                                    <f:convertNumber pattern="#,##0.00" />
                                </h:outputLabel>

                            </p:column>
                            <p:column  headerText="C Card" style="text-align: right; ">
                                <h:outputLabel value="#{commonReport.userBills.card}">
                                    <f:convertNumber pattern="#,##0.00" />
                                </h:outputLabel>
                            </p:column> 
                            <p:column  headerText="Cheque" style="text-align: right; ">
                                <h:outputLabel value="#{commonReport.userBills.cheque}">
                                    <f:convertNumber pattern="#,##0.00" />
                                </h:outputLabel>
                            </p:column> 
                            <p:column  headerText="Slip" style="text-align: right; ">
                                <h:outputLabel value="#{commonReport.userBills.slip}">
                                    <f:convertNumber pattern="#,##0.00" />
                                </h:outputLabel>
                            </p:column> 

                        </p:summaryRow>
                    </p:dataTable>


                    <ez:tableCancelledBill bill="#{commonReport.userCancelledBills}"/>

                    <ez:tableRefundBill bill="#{commonReport.userRefundedBills}"/>

                    <ez:tablePaymentBill bill="#{commonReport.userPaymentBills}"/>

                    <ez:tablePaymentCancel bill="#{commonReport.userPaymentCancelBills}" />

                    <ez:tablePettyPayment bill="#{commonReport.pettyPayments}"  />

                    <ez:tablePettyCancel bill="#{commonReport.pettyPaymentsCancel}" />

                    <ez:tableCompanyPayment bill="#{commonReport.cashRecieves}" />

                    <ez:tableCompanyCancel bill="#{commonReport.cashRecieveCancel}"/>

                    <ez:tableAgentPayment bill="#{commonReport.agentRecieves}"  />

                    <ez:tableAgentCancel bill="#{commonReport.agentCancelBill}" />


                    <h:outputLabel value="Final Credit Total : "/>
                    <h:outputLabel style="font-weight: bold;text-align: right;" value="#{commonReport.finalCreditTotal}"><f:convertNumber pattern="#,##0.00" /></h:outputLabel>
                    <br/><br/>
                    <h:outputLabel value="Final Credit Card Total : "/>
                    <h:outputLabel style="font-weight: bold;text-align: right;" value="#{commonReport.finalCreditCardTotal}"><f:convertNumber pattern="#,##0.00" /></h:outputLabel><br/>
                    <h:outputLabel value="Final Cheque Total : "/>
                    <h:outputLabel style="font-weight: bold;text-align: right;" value="#{commonReport.finalChequeTot}"><f:convertNumber pattern="#,##0.00" /></h:outputLabel><br/>
                    <br/>
                    <h:outputLabel value="Final Slip  Total : "/>
                    <h:outputLabel style="font-weight: bold;text-align: right;" value="#{commonReport.finalSlipTot}"><f:convertNumber pattern="#,##0.00" /></h:outputLabel><br/>
                    <br/>
                    <h:outputLabel style="font-weight: bolder; font-size: 100%;text-align: right;" value="Net Cash : "/>
                    <h:outputLabel style="font-weight: bolder;font-size: 100%;text-align: right;" value="#{commonReport.finalCashTotal}" >
                        <f:convertNumber minFractionDigits="2" />

                    </h:outputLabel>


                    <br/><br/><br/>

                    <h:outputLabel value="..........................."/>
                    <h:outputLabel value="..........................." style="float: right;"/><br/>
                    <h:outputLabel value="Cashier"/>
                    <h:outputLabel value="Date" style="float: right;"/>
                </p:panel>

            </h:form>
        </h:panelGroup>
    </ui:define>

</ui:composition>
